package lianxi5;

public class Matht1 {
    public static void main(String[] args) {
        int n = 123456789;
        if(isPrime(n)){
            System.out.println(n+" is a prime number.");
        }else{
            System.out.println(n+" is not a prime number.");
        }
        for(int i = 10;i<=9;i++){
            if(ifzimishu(i)){
                System.out.println(i+" is a zimishu number.");
            }
        }
    }
    public static boolean isPrime(int n) {

        //质数判断
        for(int i = 2; i<=Math.sqrt(n);i++){
            if(n%i == 0){
                return false;
            }
        }
        return true;
    }
    public static boolean ifzimishu(int n){
        //自幂数判断
        int ge = n%10;
        int shi = n/10%10;
       // int bai = n/100%10;
        double sum = Math.pow(ge,2)+Math.pow(shi,2);
        if(sum == n){
            return true;
        }else{
            return false;
        }
    }
}
